﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace ITJZ.BitHelper.Local.UI.Component
{
    public partial class ucShow : UserControl,IComponent.IShowKnowledge
    {
        public ucShow()
        {
            InitializeComponent();
        }

        private void ucShow_Load(object sender, EventArgs e)
        {

        }

        #region IShowKnowledge 成员


        public void Show(ITJZ.BitHelper.APIModel.Knowledge knowledge)
        {
            richTextBox1.Rtf = "";//清空格式


            label1.Text = knowledge.FullName;
            try
            {
                richTextBox1.Rtf = knowledge.Content;
            }
            catch { richTextBox1.Text = knowledge.Content; }

            //richTextBox1.Clear();
            //try
            //{
            //    using (MemoryStream ms = new MemoryStream())
            //    {
            //        StreamWriter write = new StreamWriter(ms);
            //        write.Write(knowledge.Content);
            //        ms.Position = 0;
            //        richTextBox1.LoadFile(ms, RichTextBoxStreamType.RichText);
            //    }
            //}
            //catch { richTextBox1.Text = knowledge.Content; }
        }

        #endregion
    }
}
